package com.example.hotel_demo.mapper;

import com.example.hotel_demo.pojo.Room;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
@Mapper
public interface RoomMapper {
    @Select("select * from room")
    public List<Room> getRoomAll();

    @Select("select count(*) from room")
    public int getRoomCount();

    @Insert("insert into room (roomID,floor,roomTelephone,typeName) values (#{roomID},#{floor},#{roomTelephone},#{typeName})")
    public int addRoom(int roomID, int floor, int roomTelephone, String typeName);

    @Update("update room set roomState = #{roomState} where roomID=#{roomID}")
    public int updateRoomStateByRoomID(int roomState,int roomID);

    @Update("update room set typeName = #{typeName} where roomID=#{roomID}")
    public int updateRoomTypeByRoomID(String typeName,int roomID);

    @Update("update room set typeName = #{typeName}, roomTelephone = #{roomTelephone}, floor = #{floor}  where roomID=#{roomID}")
    public int updateRoomByRoomID(int roomID, int floor, int roomTelephone, String typeName);

    @Delete("delete from room where roomID = #{roomID}")
    public int deleteRoomByRoomID(int roomID);
}
